package com.yuexunit.operationman.nbsy.module.SurgicalReceipt.ui;

import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.yuexunit.operationman.nbsy.R;
import com.yuexunit.operationman.nbsy.base.BaseKJActivity;
import com.yuexunit.operationman.nbsy.config.AppConfig;
import com.yuexunit.operationman.nbsy.module.SurgicalReceipt.ui.fragment.Fragment_SR_Operate;
import com.yuexunit.operationman.nbsy.module.SurgicalReceipt.ui.fragment.Fragment_SR_Postoperative;
import com.yuexunit.operationman.nbsy.module.SurgicalReceipt.ui.fragment.Fragment_SR_Ward;

import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * Created by chenss on 2017/7/26 0026.
 */

public class Act_SurgicalReceipt_Preview extends BaseKJActivity {

    @Bind(R.id.tv_patient_name)
    TextView tvPatientName;
    @Bind(R.id.tv_patient_sex)
    TextView tvPatientSex;
    @Bind(R.id.tv_patient_visitno)
    TextView tvPatientVisitno;
    @Bind(R.id.tv_patient_disease)
    TextView tvPatientDisease;
    @Bind(R.id.surgicalreceipt_preview_img_01)
    ImageView surgicalreceiptPreviewImg01;
    @Bind(R.id.surgicalreceipt_preview_img_02)
    ImageView surgicalreceiptPreviewImg02;
    @Bind(R.id.surgicalreceipt_preview_img_03)
    ImageView surgicalreceiptPreviewImg03;

    Fragment_SR_Ward fragmentSrWard;
    Fragment_SR_Operate fragmentSrOperate;
    Fragment_SR_Postoperative fragmentSrPostoperative;

    @Override
    public void setRootView() {
        setContentView(R.layout.act_surgicalreceipt_preview);
        ButterKnife.bind(this);
    }

    @Override
    public void initData() {
        super.initData();
        setTitle();
        fragmentSrWard = new Fragment_SR_Ward();
        fragmentSrOperate = new Fragment_SR_Operate();
        fragmentSrPostoperative = new Fragment_SR_Postoperative();
        changeFragment(R.id.content, fragmentSrWard);
    }

    private void setTitle() {
        tvPatientName.setText(AppConfig.SURGICALRECEIPTBEAN.getObject().getTransferHandover().getPatientName());
        if (AppConfig.SURGICALRECEIPTBEAN.getObject().getTransferHandover().getPatientSex().equals("1")) {
            tvPatientSex.setText("男");
        } else if (AppConfig.SURGICALRECEIPTBEAN.getObject().getTransferHandover().getPatientSex().equals("2")) {
            tvPatientSex.setText("女");
        } else {
            tvPatientSex.setText("不详");
        }
        tvPatientVisitno.setText("住院号" + AppConfig.SURGICALRECEIPTBEAN.getObject().getTransferHandover().getInHospitalNo());
        tvPatientDisease.setText(AppConfig.SURGICALRECEIPTBEAN.getObject().getTransferHandover().getDiagnosis());
    }

    @OnClick({R.id.titlebar_docadvice_img_back, R.id.tv_submit, R.id.surgicalreceipt_preview_ll_01, R.id.surgicalreceipt_preview_ll_02, R.id.surgicalreceipt_preview_ll_03})
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.titlebar_docadvice_img_back:
                finish();
                break;
            case R.id.tv_submit:
                finish();
                break;
            case R.id.surgicalreceipt_preview_ll_01:
                surgicalreceiptPreviewImg01.setVisibility(View.VISIBLE);
                surgicalreceiptPreviewImg02.setVisibility(View.INVISIBLE);
                surgicalreceiptPreviewImg03.setVisibility(View.INVISIBLE);
                changeFragment(R.id.content, fragmentSrWard);
                break;
            case R.id.surgicalreceipt_preview_ll_02:
                surgicalreceiptPreviewImg01.setVisibility(View.INVISIBLE);
                surgicalreceiptPreviewImg02.setVisibility(View.VISIBLE);
                surgicalreceiptPreviewImg03.setVisibility(View.INVISIBLE);
                changeFragment(R.id.content, fragmentSrOperate);
                break;
            case R.id.surgicalreceipt_preview_ll_03:
                surgicalreceiptPreviewImg01.setVisibility(View.INVISIBLE);
                surgicalreceiptPreviewImg02.setVisibility(View.INVISIBLE);
                surgicalreceiptPreviewImg03.setVisibility(View.VISIBLE);
                changeFragment(R.id.content, fragmentSrPostoperative);
                break;
        }
    }
}
